﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="match.aspx.cs" Inherits="Customer_Profile.eCard.Match.match" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register src="../../mainTop.ascx" tagname="mainTop" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>银行汇款信息对账</title>
    <LINK href="/css/style.css" type="text/css" rel="stylesheet">
    <script language="javascript" type="text/javascript" src="/js/common.js"></script>
    <script language="javascript" type="text/javascript" src="/js/CalPopUp.js"></script>
    <script language="javascript" >      
        /* 汇款信息表 */
        function grid_SelectionChanged_transfer(s, e) {            
            s.GetSelectedFieldValues("transfer_id", GetSelectedFieldValuesCallback_transfer);
            s.GetSelectedFieldValues("account_name;account_no;transfer_amount", OnGetRowValues);
        }

        function GetSelectedFieldValuesCallback_transfer(values) {          
            var extent_transferid = "";
            try {
                for (var i = 0; i < values.length; i++) {
                    extent_transferid += values[i] + ","
                }
            } finally {
            }
            var Transferid = document.getElementById("hidTransferid");
            Transferid.value = extent_transferid;
        }

        function OnGetRowValues(values) {
            gridNetbank.PerformCallback(values);
        }

        
        function GetSelectedFieldValuesCallback_netBank(values) {
            var netbank_key = "";
            try {
                for (var i = 0; i < values.length; i++) {
                    netbank_key += values[i] + ","
                }
            } finally {
            }
            
            var AccountingKey = document.getElementById("hidAccountingKey");
            AccountingKey.value = netbank_key;
        } 

        function Formcheck() {
            var hidtransferid_value = document.getElementById("hidTransferid").value;
            var AccountingKey_value = document.getElementById("hidAccountingKey").value;

            if (hidtransferid_value == '') {
                alert("请至少选择一条付款数据数据进行匹配");
                return false;
            }

            var strs = new Array(); //定义一数组
            hidtransferid_value = hidtransferid_value.substring(0, hidtransferid_value.length - 1);
            strs = hidtransferid_value.split(",");  //字符分割
            if (strs.length > 1) {
                alert("每次只能匹配一个付款信息，请只选择一条付款信息进行匹配");
                return false;
            }
            if (AccountingKey_value == '') {
                alert("请至少选择一条银行流水数据进行匹配");
                return false;
            }
            var strs1 = new Array(); //定义一数组
            AccountingKey_value = AccountingKey_value.substring(0, AccountingKey_value.length - 1);
            strs1 = AccountingKey_value.split(",");  //字符分割
            if (strs1.length > 1) {
                alert("每次只能匹配一个银行流水信息，请只选择一条银行流水信息进行匹配");
                return false;
            }

            return confirm("are you sure?");
        }

        function checkSubmit() {
            return confirm("are you sure?");
        }

        function Formcheck1() {
            var hidtransferid_value = document.getElementById("hidTransferid").value;
            var AccountingKey_value = document.getElementById("hidAccountingKey").value;

            if (hidtransferid_value == '') {
                alert("请至少选择一条付款数据数据进行匹配解锁");
                return false;
            }

            var strs = new Array(); //定义一数组
            hidtransferid_value = hidtransferid_value.substring(0, hidtransferid_value.length - 1);
            strs = hidtransferid_value.split(",");  //字符分割
            if (strs.length > 1) {
                alert("每次只能匹配一个付款信息，请只选择一条付款信息进行匹配解锁");
                return false;
            }

            if (AccountingKey_value == '') {
                alert("请至少选择一条银行流水数据进行匹配解锁");
                return false;
            }

            var strs1 = new Array(); //定义一数组
            AccountingKey_value = AccountingKey_value.substring(0, AccountingKey_value.length - 1);
            strs1 = AccountingKey_value.split(",");  //字符分割
            if (strs1.length > 1) {
                alert("每次只能匹配一个银行流水信息，请只选择一条银行流水信息进行匹配解锁");
                return false;
            }

            return confirm("are you sure?");
        }

        /* 银行对账信息表 */
        function grid_SelectionChanged_netBank(s, e) {
            s.GetSelectedFieldValues("seq_no", GetSelectedFieldValuesCallback_netBank);
        }
    </script>
</head>
<body style="margin-top: 0px" >
    <form id="form1" runat="server">
    <div>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td colspan="2"  valign="top">
                    <!--客户信息-->
                    <uc1:mainTop ID="mainTop1" runat="server" />
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td bgcolor="#1765a7"><img src="/images/spacer.gif" width="1" height="3"></td>
						</tr>
						<tr>
							<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="12" class="bglist1"><img src="/images/arw_blu_rgt.gif" width="4" height="7"></td>
										<td class="bglist1">用户信息</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td><img src="/images/spacer.gif" width="1" height="1"></td>
						</tr>
					</table>
                    <asp:Repeater ID="rptCparty" runat="server">
                        <HeaderTemplate>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        </HeaderTemplate>
                        <ItemTemplate>
                        <tr>
							<td class="bglist-3"  width="8%">客户姓名：</td>
							<td class="bglist-4"  width="17%">
								<%#Eval("cparty_name")%>                        
							</td>
							<td class="bglist-3"  width="8%">证件类型：</td>
							<td class="bglist-4" width="17%">
								<%#Eval("id_type")%>
							</td>
                            <td class="bglist-3"  width="8%">证件号码：</td>
							<td class="bglist-4"  width="17%">
								<%#Eval("id_no")%>
							</td>
							<td class="bglist-3"  width="8%">性别：</td>
							<td class="bglist-4" width="17%">
								<%#Eval("sex")%>
							</td>
						</tr>
                        <tr>
							<td class="bglist-3">生日：</td>
							<td class="bglist-4">
                               <%#Eval("birthday")%>
							</td>
							<td class="bglist-3">联系方式：</td>
							<td class="bglist-4">
								<%#Eval("phone")%> &nbsp; <%#Eval("email")%>
							</td>
                            <td class="bglist-3">邮编：</td>
							<td class="bglist-4">
                                <%#Eval("zipcode")%>
							</td>
							<td class="bglist-3">家庭住址：</td>
							<td class="bglist-4">
								<%#Eval("address")%>
							</td>
						</tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>        
                        </FooterTemplate>
                    </asp:Repeater>   
                    <!--交易信息-->
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td bgcolor="#1765a7"><img src="/images/spacer.gif" width="1" height="3"></td>
						</tr>
						<tr>
							<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="12" class="bglist1"><img src="/images/arw_blu_rgt.gif" width="4" height="7"></td>
										<td class="bglist1">交易信息</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td><img src="/images/spacer.gif" width="1" height="1"></td>
						</tr>
					</table>                       
                    <asp:Repeater ID="rptDeals" runat="server">
                        <HeaderTemplate>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        </HeaderTemplate>
                        <ItemTemplate>
                        <tr>
							<td class="bglist-3"  width="8%">产品编码：</td>
							<td class="bglist-4"  width="17%">
								<%#Eval("procduct_name")%>                        
							</td>
							<td class="bglist-3"  width="8%">到期操作：</td>
							<td class="bglist-4"  width="17%">
								<%#Eval("due_prodName")%>
							</td>
                            <td class="bglist-3"  width="8%">到期操作说明：</td>
							<td class="bglist-4"  width="17%">
								<%#Eval("due_prodremark")%>
							</td>
							<td class="bglist-3"  width="8%">卡号：</td>
							<td class="bglist-4" width="17%">
								<%#Eval("card_no")%>
							</td>
						</tr>
                        <tr>
							<td class="bglist-3" >购买金额：</td>
							<td class="bglist-4" >
								<font color="red"><%#Eval("initial_amount")%></font>
							</td>
							<td class="bglist-3" >应收金额：</td>
							<td class="bglist-4">
								<%#Eval("should_amount")%>
							</td>
                            <td class="bglist-3" >标准折扣：</td>
							<td class="bglist-4" >
								<%#Eval("stand_discount")%>
							</td>
							<td class="bglist-3" >实际折扣：</td>
							<td class="bglist-4">
								<%#Eval("real_discount")%>
							</td>
						</tr>
                        <tr>
							<td class="bglist-3" >到期金额：</td>
							<td class="bglist-4" >
								<%#Eval("due_amount")%>                        
							</td>
							<td class="bglist-3" >折扣差价：</td>
							<td class="bglist-4">
								<%#Eval("amount_spread")%>
							</td>                            
							<td class="bglist-3" >销售地区：</td>
							<td class="bglist-4">
								<%#Eval("entity")%>
							</td>
                            <td class="bglist-3" >销售员：</td>
							<td class="bglist-4" >
								<%#Eval("dealer")%>
							</td>
						</tr>
                        <tr>							
							<td class="bglist-3" >是否代理销售：</td>
							<td class="bglist-4">
								<%#Eval("if_agentsale")%>
							</td>
                            <td class="bglist-3" >代理名称：</td>
							<td class="bglist-4" >
								<%#Eval("agent_id")%>
							</td>
							<td class="bglist-3" >是否是展期：</td>
							<td class="bglist-4">
								<font color="red"><%#Eval("if_isExtension")%></font>
							</td>
                            <td class="bglist-3">展期编号：</td>
							<td class="bglist-4">
                                <a href='ExtendOriginalDeal.aspx?extend_id=<%#Eval("extend_id")%>' target="_blank"><%#Eval("extend_id")%></a>
							</td>
						</tr>
                        <tr>							
							<td class="bglist-3" >备注：</td>
							<td class="bglist-4">
								<%#Eval("remark")%>
							</td>
                            <td class="bglist-3" >指定人：</td>
							<td class="bglist-4" colspan=5>
								<%#Eval("designee")%>
							</td>
						</tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td class="bglist-3"  width="8%">附件列表：</td>
                            <td>
                                <asp:Repeater ID="rptAttach" runat="server">
                                    <ItemTemplate>
                                       <a href='<%#Eval("attach_url")%>' target="_blank"><%#Eval("view_name")%></a> &nbsp;
                                    </ItemTemplate>                            
                                </asp:Repeater>
                            </td>
						</tr>						
					</table>       
                </td>
            </tr>
    </table>
            

             <table bordercolor="#c2d2e2" cellspacing="0" cellpadding="2" width="100%" border="1">                        
                        <tr>
                            <td>
                               <dx:ASPxGridView ID="gridTransfer" runat="server"  Width="100%"  KeyFieldName="transfer_id"
                    CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css"  CssPostfix="Office2003Blue">
                                   <settingsbehavior allowsort="False" />
                    <SettingsPager PageSize="50">
                    </SettingsPager>
                    <Settings ShowHorizontalScrollBar="True" ShowVerticalScrollBar="True" VerticalScrollableHeight="100" />

<Settings ShowVerticalScrollBar="True" ShowHorizontalScrollBar="True" VerticalScrollableHeight="100"></Settings>

                    <Styles CssPostfix="Office2003Blue" CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css"></Styles>
<ClientSideEvents SelectionChanged="grid_SelectionChanged_transfer"></ClientSideEvents>
                    <Columns>
                        <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" width="25" ></dx:GridViewCommandColumn>
                        <dx:GridViewDataColumn FieldName="Transfer_id" Visible="false" width="10%"  Caption="汇款号"  />
                        <dx:GridViewDataColumn FieldName="deal_no" VisibleIndex="1"  width="5%" Caption="交易号"/>
                        <dx:GridViewDataColumn FieldName="card_no" VisibleIndex="2" width="10%" Caption="卡号"/>
                        <dx:GridViewDataColumn FieldName="transfer_type" VisibleIndex="3" width="5%" Caption="付款类型" />
                        <dx:GridViewDataColumn FieldName="account_name" VisibleIndex="4" width="5%" Caption="客户姓名" />
                        <dx:GridViewDataColumn FieldName="bank_name" VisibleIndex="5" width="10%" Caption="汇款银行" />
                        <dx:GridViewDataColumn FieldName="account_no" VisibleIndex="6" width="12%" Caption="汇款账号" />
                        <dx:GridViewDataColumn FieldName="transfer_amount" VisibleIndex="7" width="10%" Caption="汇款金额" />
                        <dx:GridViewDataColumn FieldName="to_account" VisibleIndex="8" width="10%" Caption="汇入账户" />
                        <dx:GridViewDataColumn FieldName="transfer_date" VisibleIndex="9" width="10%" Caption="汇款日期" />
                        <dx:GridViewDataColumn FieldName="remark" VisibleIndex="10" width="300" Caption="备注" >
                        </dx:GridViewDataColumn>
                        <dx:GridViewDataColumn Caption="匹配号" width="5%" VisibleIndex="11">
                            <DataItemTemplate>
                                <a href='netbank_matachinfo.aspx?netbank_seqno=<%#Eval("netbank_seqno") %>' target="_blank" ><%#Eval("netbank_seqno") %></a>
                            </DataItemTemplate>
                        </dx:GridViewDataColumn>
                    </Columns>                                                
                    <ClientSideEvents SelectionChanged="grid_SelectionChanged_transfer" />
                </dx:ASPxGridView>
                <asp:HiddenField ID="hidTransferid" runat="server" />
                            </td>
                        </tr>
                    </table>
            <table border="1" width="100%">
            <tr>
                <td>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td>所属银行：</td>
                        <td>
                            <asp:DropDownList ID="dropBank" runat="server"></asp:DropDownList>
                        </td>
                        <td>业务日期：</td>
                        <td>
                            <asp:TextBox ID="txtcreatedatebegin" runat="server" CssClass="input2" Width="120px"></asp:TextBox>&nbsp;&nbsp;&nbsp;
                            <img style="cursor: hand" onclick="JavaScript:calPopForCMon(txtcreatedatebegin, 'ss');" height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                            <asp:Button ID="txtSearch" runat="server" Text="搜索" onclick="txtSearch_Click" />&nbsp;
                            <asp:Button ID="btnMatch" Text="资金匹配" runat="server" onclick="btnMatch_Click" OnClientClick="return Formcheck();"/>
                            <asp:Button ID="btnUnMatch" Text="资金匹配解锁" runat="server" 
                                OnClientClick="return Formcheck1();" onclick="btnUnMatch_Click"/>
                        </td>
                        </tr>
                    </table>
                </td>                
            </tr>
            <tr>
                <td colspan="2">
                    <dx:ASPxGridView ID="gridNetbank" runat="server" Width="100%"  KeyFieldName="accounting_key" 
                        CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                        CssPostfix="Office2003Blue" oncustomcallback="gridNetbank_CustomCallback">
                        <%-- <SettingsBehavior AllowFocusedRow="True"/>   --%>
                        <ClientSideEvents SelectionChanged="grid_SelectionChanged_netBank" />
                        <Settings ShowVerticalScrollBar="true" VerticalScrollableHeight="270"/>
                        <ClientSideEvents SelectionChanged="grid_SelectionChanged_netBank"></ClientSideEvents>
                        <Columns>
                            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="35"></dx:GridViewCommandColumn> 
                            <dx:GridViewDataColumn FieldName="seq_no" VisibleIndex="1" Width="3%" Caption="Key" />
                            <dx:GridViewDataColumn FieldName="business_date" VisibleIndex="2" Width="6%" Caption="交易日期" />
                            <dx:GridViewDataColumn FieldName="accounting_key" VisibleIndex="3" Width="10%" Caption="时间戳" />
                            <dx:GridViewDataColumn FieldName="cparty_bankname" VisibleIndex="4" Caption="汇款银行" />
                            <dx:GridViewDataColumn FieldName="cparty_accountname" VisibleIndex="5" Caption="汇款用户名" />
                            <dx:GridViewDataColumn FieldName="cparty_accountno" VisibleIndex="6" Caption="汇款账号" />
                            <dx:GridViewDataColumn FieldName="crebit_amount" VisibleIndex="7" Width="6%" Caption="汇款金额" />
                            <dx:GridViewDataColumn FieldName="match_balance" VisibleIndex="8" Width="6%" Caption="匹配余额" />
                            <dx:GridViewDataColumn FieldName="remark" VisibleIndex="9" Caption="备注" />                            
                        </Columns>                 
                        <SettingsPager mode="ShowAllRecords">                           
                        </SettingsPager>
                        <Settings ShowVerticalScrollBar="True" VerticalScrollableHeight="270"></Settings>
                        <Images SpriteCssFilePath="~/App_Themes/Office2003Blue/{0}/sprite.css">
                            <LoadingPanelOnStatusBar Url="~/App_Themes/Office2003Blue/GridView/gvLoadingOnStatusBar.gif">
                            </LoadingPanelOnStatusBar>
                            <LoadingPanel Url="~/App_Themes/Office2003Blue/GridView/Loading.gif">
                            </LoadingPanel>
                        </Images>
                        <ImagesFilterControl>
                            <LoadingPanel Url="~/App_Themes/Office2003Blue/Editors/Loading.gif">
                            </LoadingPanel>
                        </ImagesFilterControl>
                        <Styles CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                            CssPostfix="Office2003Blue">
                            <Header ImageSpacing="5px" SortingImageSpacing="5px">
                            </Header>
                            <LoadingPanel ImageSpacing="10px">
                            </LoadingPanel>
                        </Styles>
                        <StylesEditors>
                            <ProgressBar Height="25px">
                            </ProgressBar>
                        </StylesEditors>
                    </dx:ASPxGridView>
                    <asp:HiddenField ID="hidAccountingKey" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    起息日：<asp:TextBox ID="txtValue_date" runat="server" Font-Bold="True" ForeColor="Red" ></asp:TextBox>&nbsp;
                    <img style="cursor: hand" onclick="JavaScript:calPopForCMon(txtValue_date, 'ss');" height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                </td>
                <td>
                    到期日：<asp:TextBox ID="txtDue_date" runat="server" Font-Bold="True" ForeColor="Red"></asp:TextBox>&nbsp;
                    <img style="cursor: hand" onclick="JavaScript:calPopForCMon(txtDue_date, 'ss');" height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                </td>
            </tr>
            <tr>
                <td>
                    备注：<asp:TextBox ID="txtPassRemark" runat="server"></asp:TextBox>
                    <asp:Button ID="btnPass" runat="server" Text="通过审核" OnClientClick="return checkSubmit();"  onclick="btnPass_Click" />
                </td>
                <td>
                    退回原因：<asp:TextBox ID="txtBackReason" runat="server"></asp:TextBox>
                    <asp:Button ID="btnBack" runat="server"  OnClientClick="return checkSubmit();" Text="退回" onclick="btnBack_Click" />
                </td>
            </tr>
            <tr>                
                <td colspan="2">
                   提示信息： <asp:Label ID="lbWarning" runat="server" ForeColor="Red"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
<%=strScript %>